﻿using System;

class A_nacci
{
    static void Main()
    {
        int first = Convert.ToChar(Console.ReadLine()) - 64;       // Useing ASCII codes: 'A' -> 65 ... 'Z' -> 95 ==> 'A' - 64 = 1 ... 'Z' - 64 = 26
        int second = Convert.ToChar(Console.ReadLine()) - 64;
        
        int n = int.Parse(Console.ReadLine());

        Console.WriteLine((char)(first + 64));                     // First line

        for (int i = 1; i < n; i++)                                // The rest of the lines
        {
            int temp = first;

            if ((first + second) > 26)
            {
                first = second;
                second = (temp + second) % 26;
            }
            else
            {
                first = second;
                second = temp + second;
            }

            Console.Write((char)(first + 64) + new string(' ', i - 1) + (char)(second + 64));
            Console.WriteLine();

            temp = first;

            if ((first + second) > 26)
            {
                first = second;
                second = (temp + second) % 26;
            }
            else
            {
                first = second;
                second = temp + second;
            }
        }
    }
}

